const arr = [{ top: -3 }, { top: 5 }, { top: 9 }, { top: 1 }, { top: 7 }, { top: -5 }]

//  求非负数的最小值 


var min = arr[0]

for (var i = 1; i < arr.length; i++) {

    if ((min.top > arr[i].top && arr[i].top >= 0) || min.top < 0) {
        min = arr[i]
    }

}

console.log(min.top < 0 ? null : min);



var list = [1, 2, 12, 30, 40, 80, 90, 120, 152, 159, 160, 789, 1000] 